#ifndef XRENDER_PACK_H
#define XRENDER_PACK_H

#ifdef XEXPORTING
#define XEXPORT_DLL __declspec(dllexport)
#else
#define XEXPORT_DLL __declspec(dllimport)
#endif

#include <string>
#include <vector>
#include <XMain.h>
#include <XTexture.h>


class XEXPORT_DLL XRenderPack
{
private:
	XHash Hash;
	int Vertices;

	XTexture* Texture;
	std::vector<XVertex> TextureVertex;

	unsigned int VertexBuffer;
	unsigned int IndexBuffer;

	XColor Color;
	XVector Translation;
	float Rotation;
	float Scale;
	bool LineMode;

	std::vector<XVertex> Vertex;

	void _initBuffers();
	void _updateBuffers();
	void _freeBuffers();

public:
	XRenderPack(XHash hash);
	~XRenderPack();

	void SetColor(XColor color);
	void SetTranslation(XVector translation);
	void SetRotation(float degree);
	void SetScale(float scale);
	void SetTexture(XTexture* tex, XVertex* vertices, int num);
	void SetVertex(XVertex* vertices, int num);
	void SetLineMode();
	void SetTriangleMode();

	XHash GetHash();
	XColor GetColor();
	XVector GetTranslation();
	float GetRotation();
	float GetScale();

	friend class XDrawModule;
};

#endif